package com.tang.objectOriented.middleRank.poly_.basics;

public class PolyExercise02 {
    //编写一个main方法
    public static void main(String[] args) {
        Sub sub = new Sub();
        System.out.println("sub.count = " + sub.count);//3
        sub.display();//3

        Base base = sub;
        System.out.println("base.count = " + base.count);//2
        base.display();//3

        Sub subs=(Sub) sub;
        subs.est();



    }
}


class Base{
    int count=2;
    public void display(){
        System.out.println("this.count = " + this.count);
    }


}


class Sub extends Base{
    int count=3;
    public void display() {
        System.out.println("this.count = " + this.count);
        System.out.println("count = " + count);
    }
    public void est(){
        System.out.println("est");
    }
}